import requests

from comment.get_header_tools import get_req_header  # 导包 获取令牌

# 添加部门

req_header = get_req_header()
req = requests.post(url="http://ihrm2-test.itheima.net/api/company/department",
                    headers=req_header, json={"name": "测试部", "code": "00001"})

print(req.json())

# 修改部门
req = requests.put(url="http://ihrm2-test.itheima.net/api/company/department/1598135951538909184",
                   headers=req_header, json={"name": "测试部", "code": "00002"})

print(req.json())

# 查询
req = requests.get(url="http://ihrm2-test.itheima.net/api/company/department/1598135951538909184",
                   headers=req_header)

print(req.json())

# 删除
req = requests.delete(url="http://ihrm2-test.itheima.net/api/company/department/1598135951538909184",
                      headers=req_header)
print(req.json())
